﻿using EFCore3.Entity;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace EFCore3.EntityConfig
{
    public class CommentConfig : IEntityTypeConfiguration<Comment>
    {
        public void Configure(EntityTypeBuilder<Comment> builder)
        {
            builder.ToTable("T_Comment").HasKey(c => c.Id);
            builder.HasOne(p => p.LinkArticle).WithMany(p=>p.Commments).IsRequired()
                .HasForeignKey(p=>p.ArticalId);
        }
    }
}
